package com.quyeying.service;

import com.fasterxml.jackson.databind.JsonNode;
import com.quyeying.entity.TblOrderBaseEntity;
import com.baomidou.mybatisplus.extension.service.IService;
import com.quyeying.utils.result.R;
import org.springframework.web.bind.annotation.RequestBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
* <p>
 * 订单基础信息表 服务类
 * </p>
*
* @author skx
* @since 2022-07-19
*/
public interface TblOrderBaseService extends IService<TblOrderBaseEntity> {

    /**
     * 查询订单基础信息表分页数据
     *
     *
     * @param page      页码
     * @param pageCount 每页条数
     * @param orderStatus 订单状态
     * @param searchType 搜索状态
     * @param orderType 订单状态
     * @param id 商家id
     * @param s
     * @param startTime
     * @param sort  排序
     * @return R
     */
    R findListByPage(Integer page, Integer pageCount, Integer orderStatus, String search, String searchType, String orderType, Long id, String sort, String startTime, String endTime);

    /**
     * 查询订单基础信息表分页数据
     *
     * @param page      页码
     * @param pageCount 每页条数
     * @param orderStatus 订单状态
     * @return R
     */
    R findListByPage(HttpServletRequest request, Integer page, Integer pageCount, Integer orderStatus);

    /**
     * 添加订单基础信息表
     *
     * @param tblOrderBaseEntity 订单基础信息表
     * @return R
     */
    R add(TblOrderBaseEntity tblOrderBaseEntity);

    /**
     * 删除订单基础信息表
     *
     * @param id 主键
     * @return R
     */
    R delete(Long id);

    /**
     * 修改订单基础信息表
     *
     * @param tblOrderBaseEntity 订单基础信息表
     * @return R
     */
    R updateData(TblOrderBaseEntity tblOrderBaseEntity);

    /**
     * id查询数据
     *
     * @param id id
     * @return R
     */
    R findById(Long id);

    /**
     * 发货
     */
    void ship(TblOrderBaseEntity orderBaseEntity);

    /**
     * 导出订单数据
     */
    void exportWaitShipOrderInfo(HttpServletResponse response, Long id, @RequestBody Map<String, Object> reqParam);

    /**
     * 创建订单
     */
    R createOrder(HttpServletRequest request, Map<String, Object> params);

    /**
     * 处理支付成功订单
     */
    void processPaymentSuccessOrder(JsonNode jsonNode);

    /**
     * 确认收货
     * @param orderId
     */
    void confirmOrder(long orderId);

    /**
     * 申请退款
     * @param request
     * @param jsonNode
     * @return
     */
    R refund(HttpServletRequest request, JsonNode jsonNode);

    R cancelOrder(long orderId, int cancelType);

    /**
     * 还原库存
     * @param orderId
     */
    void restoreStock(Long orderId);

    /**
     * 撤销申请退款
     * @param orderId
     * @return
     */
    R revokeRefund(Long orderId);

    /**
     * 查询订单状态数量
     **/
    R findOrderTypeNum(HttpServletRequest request);

    Integer getUnreadNum(long userId);

    R getReceiveGiftData(HttpServletRequest request, Long orderId);

    R receiveGifts(HttpServletRequest request, Long orderId, Map<String, Object> params);

    R getReceiveGiftsList(HttpServletRequest request, Integer current, Integer size);

    R getGiveGiftsList(HttpServletRequest request, Integer current, Integer size);

    /**
     * 根据订单id获取领取记录列表
     * @param id
     * @return
     */
    R getGiftCollectionList(Long id);

    R getSonOrderList(Long orderId);

    /**
     * 自购订单改礼品订单
     * @param request
     * @param params
     * @return
     */
    R orderUpdateState(HttpServletRequest request, Map<String, Object> params);

    R orderUpdateAddress(HttpServletRequest request, Map<String, Object> params);
}
